<%--
  Created by IntelliJ IDEA.
  User: Asus
  Date: 2022/4/14
  Time: 12:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>实现数据的自动填充</title>
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#uid").blur(function(){
                var uid = $(this).val();
                $.post("/testuid","uid="+uid,function(rs){
                    rs = eval("("+rs+")");// 转换成可以处理的json
                    // rs是json格式的对象
                    $("#uname").val(rs.userName);
                    $("#ucity").val(rs.userCity);
                });
            });
        })
    </script>
</head>
<body>
    <h1>实现数据的自动填充</h1>
    uid:<input type="text" id="uid"><br>
    uname:<input type="text" id="uname"><br>
    ucity:<input type="text" id="ucity"><br>
</body>
</html>
